package com.song.dp.utils;

import com.sun.org.apache.xpath.internal.operations.Bool;
import lombok.Data;

/**
 * @author TonySong
 * @date 2024/8/8 0008
 * @time 14:59
 */
@Data
public class R<T> {
    private Integer code;
    private String message;
    private Boolean flag;
    private T data;
    public static <T>  R<T> success(T data){
        R<T> r = new R<>();
        r.setCode(200);
        r.setMessage("success");
        r.setFlag(true);
        r.setData(data);
        return r;
    }

    public static <T>  R<T> error(Integer code,String message){
        R<T> r = new R<>();
        r.setCode(code);
        r.setMessage(message);
        r.setFlag(false);
        return r;
    }

}
